package edu.codink.xq.center.entity;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * Userinfo entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "USERINFO")
public class Userinfo implements java.io.Serializable
{

	private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
	private static final long serialVersionUID = 1L;
	private Integer ygbh;
	private String loginname;
	private String password;
	private String username;
	private String phone;
	private String email;
	private String addres;
	private String sex;
	private String department;
	private String post;
	private Date createtime;
	private Integer functionId;
	private String createtimeStr;

	// Constructors

	/** default constructor */
	public Userinfo()
	{
	}

	/** minimal constructor */
	public Userinfo(Integer ygbh)
	{
		this.ygbh = ygbh;
	}

	/** full constructor */
	public Userinfo(Integer ygbh, String loginname, String password,
			String username, String phone, String email, String addres,
			String sex, String department, String post, Date createtime,
			Integer functionId)
	{
		super();
		this.ygbh = ygbh;
		this.loginname = loginname;
		this.password = password;
		this.username = username;
		this.phone = phone;
		this.email = email;
		this.addres = addres;
		this.sex = sex;
		this.department = department;
		this.post = post;
		this.createtime = createtime;
		this.functionId = functionId;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)//主键生成策略，依赖于数据
	@Column(name = "YGBH", unique = true, nullable = false)
	public Integer getYgbh()
	{
		return this.ygbh;
	}

	public void setYgbh(Integer ygbh)
	{
		this.ygbh = ygbh;
	}

	@Column(name = "LOGINNAME", length = 50)
	public String getLoginname()
	{
		return this.loginname;
	}

	public void setLoginname(String loginname)
	{
		this.loginname = loginname;
	}

	@Column(name = "PASSWORD", length = 50)
	public String getPassword()
	{
		return this.password;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}

	@Column(name = "USERNAME", length = 50)
	public String getUsername()
	{
		return this.username;
	}

	public void setUsername(String username)
	{
		this.username = username;
	}

	@Column(name = "PHONE", length = 20)
	public String getPhone()
	{
		return this.phone;
	}

	public void setPhone(String phone)
	{
		this.phone = phone;
	}

	@Column(name = "EMAIL", length = 100)
	public String getEmail()
	{
		return this.email;
	}

	public void setEmail(String email)
	{
		this.email = email;
	}

	@Column(name = "ADDRES", length = 500)
	public String getAddres()
	{
		return this.addres;
	}

	public void setAddres(String addres)
	{
		this.addres = addres;
	}

	@Column(name = "SEX", length = 20)
	public String getSex()
	{
		return this.sex;
	}

	public void setSex(String sex)
	{
		this.sex = sex;
	}

	@Column(name = "DEPARTMENT", length = 50)
	public String getDepartment()
	{
		return this.department;
	}

	public void setDepartment(String department)
	{
		this.department = department;
	}

	@Column(name = "POST", length = 50)
	public String getPost()
	{
		return this.post;
	}

	public void setPost(String post)
	{
		this.post = post;
	}

	@Column(name = "CREATETIME", length = 23)
	public Date getCreatetime()
	{
		return this.createtime;
	}

	public void setCreatetime(Date createtime)
	{
		this.createtime = createtime;
	}

	@Column(name = "FUNCTIONID")
	public Integer getFunctionId()
	{
		return functionId;
	}

	public void setFunctionId(Integer functionId)
	{
		this.functionId = functionId;
	}

	@Transient
	public String getCreatetimeStr()
	{
		if (this.getCreatetime() != null) 
		{
			createtimeStr = format.format(this.getCreatetime());
		}
		return createtimeStr;
	}

	public void setCreatetimeStr(String createtimeStr)
	{
		this.createtimeStr = createtimeStr;
	}

}